package com.aboo.fastjson;

import com.alibaba.fastjson2.filter.ValueFilter;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassName FastjsonValueFilter
 * @Description
 * @Author louan
 * @Date 2021/3/25
 */
public class FastjsonValueFilter implements ValueFilter {

    /**
     * base64格式的图片参数名
     *
     * @author louan
     * @date 2021/3/25
     * @param
     * @return
     **/
    private static final String PICTURE_PARAM = "base64Image";

    @Override
    public Object apply(Object o, String key, Object value) {
        if (key.equals(PICTURE_PARAM) && (value instanceof String) && StringUtils.isNotBlank((String) value)) {
            return "敏感图片，省略";
        }

        return value;
    }
}
